

<article class="module width_3_quarter" id="article_cat">
  <header>
    <h3 class="tabs_involved">小店列表</h3>
   <ul class=" tabs">
     	<li>根据店铺名称：<input type="text"  name="cat_name" style="width:50px" value="店铺名称" onclick="if(this.value=='店铺名称') this.value=''"/> <input type="button" class="alt_btn" value="GO" onclick="ordrSearchByCatName()"/></li>
        <li>根据店铺搜索：<input type="text"  name="cat_id" style="width:50px" value="店铺ID" onclick="if(this.value=='店铺ID') this.value=''"/> <input type="button" class="alt_btn" value="GO" onclick="ordrSearchByCatId()"/></li>
       <li><a href="admins.php?act=goods_cat_export">导出</a></li>
      </ul>
  </header>
  <div class="tab_container" >
    <div id="tab1" class="tab_content">
      <table class="tablesorter" cellspacing="0">
        <thead>
          <tr>
          	<th width="50px;">ID</th>
            <th width="50px;">图片</th>
            <th width="250px;">名称</th>
            <th width="50px;">推荐</th>
           
        	<th width="50px;">积分</th>
           
            <th width="60px;">加V</th>
            <th width="120px;">操作</th>
          </tr>
        </thead>
        <tbody>
     
          
          
          {{foreach from=$cat item=list key=key}}
          <tr >
            <td>{{$list.cat_id}} </td> 
            <td><img src="{{$list.thumb}}" width="80"  height="80"/></td>
            <td><a href="../category.php?cat_id={{$list.cat_id}}" target="_blank">{{$list.cat_name}}</a></td>
          
          
             <td>
             <input type="checkbox" {{if $list.sort_order<10}} checked="checked"{{/if}} onclick="catSort({{$list.cat_id}},this.checked)"/>
             </td>
               <td><input type="text" value="{{$list.gold}}" onchange="changeGold('{{$list.cat_id}}','{{$list.gold}}',this.value)" size="3"/></td>
            <td><input type="checkbox" {{if $list.is_show ==2}} checked="checked"{{/if}} onclick="catPlusV({{$list.cat_id}},this.checked)"/></td>
            <td><a class="alt_btn" href="admins.php?act=del_goods_cat&cat_id={{$list.cat_id}}">删除</a> / 
            <a class="alt_btn" href="../category.php?cat_id={{$list.cat_id}}&admin=1" target="_blank">修改</a>
            </td>
          </tr>
              
          {{/foreach}}
      
         
       
         
        </tbody>
      </table>
    </div>
    <!-- end of #tab1 --> 
    
  </div>
  <!-- end of .tab_container --> 
  
</article>
{{include file="../../pages.htm"}}
<script>
function catSort(cat_id,checked){
	if( checked)
	{
		var data = "act=cat_sort&cat_id="+cat_id+"&sort="+1;
		Main.AJAX("admins.php",data);
	}
	else
	{
		var data = "act=cat_sort&cat_id="+cat_id+"&sort="+50;
		Main.AJAX("admins.php",data);
	}
}
 function ordrSearchByCatId(){
	 var cat_id = $("input[name=cat_id]").val();
	 if(cat_id*1>0)
	 {
		 $("#main").load('admins.php?act=goods_cat&cat_id='+cat_id+' #main .module',{},function(res){
				$("#main").hide().fadeIn("slow");
		});
	 	
	 
	 }
	 else
	 {
		alert('请输入有效的ID');	 
	 }
	 
 }
  function ordrSearchByCatName(){
	 var cat_name = $("input[name=cat_name]").val();
	 if(cat_name)
	 {
		 location.href = 'admins.php?act=goods_cat&cat_name='+cat_name+'';
		 
	 
	 }
	 else
	 {
		alert('请输入有效的名称');	 
	 }
	 
 }
  function changeGold(cat_id,gold,val){
	 if(cat_id*1>0)
	 {
		 var data = new Object;
		 //var def = "系统返回"+gold+" 小区币 给 "+user_name+"  操作人:system";
	  	 var yes = prompt("理由");
		 data.comment = yes;
		
		 data.cat_id = cat_id;
		
		 data.return = val*1-gold*1;
		
		 if(yes)
		 {
			
			var da = "act=send_gold&data="+$.toJSON(data);
			Main.AJAX("admins.php",da,changeGoldRes);
		 }
		 
		 
	 }
 }
 function changeGoldRes(){
	 $("#tab1").load('admins.php?act=goods_cat #tab1',{},function(){
	 	$("#tab1").hide().fadeIn("slow");
	 });
	// location.href = location.href;
}

function catPlusV(cat_id,checked){

	if( checked)
	{
		var da = "act=catPlusV&cat_id="+cat_id+'&is_show=2';
		Main.AJAX("admins.php",da);
	}
	else
	{
		var da = "act=catPlusV&cat_id="+cat_id+'&is_show=1';
		Main.AJAX("admins.php",da);
	}
}
</script>

